package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.bifang.engine.protect.core.annotation.NoSignCrypto;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduStudentEnroll.BindEnrollQueryVO;
import com.jwsoft.manager.common.vo.eduStudentEnroll.BindEnrollVO;
import com.jwsoft.manager.common.vo.eduStudentEnroll.StudentEnrollCntVO;
import com.jwsoft.manager.common.vo.eduStudentEnrollKindergarten.*;
import com.jwsoft.manager.core.integration.EduStudentEnrollKindergartenIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * 幼儿园报名管理网关
 *
 * @author chenzh
 * @since 2023-02-10
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "幼儿园报名管理", description = "幼儿园报名管理")
public class EduStudentEnrollKindergartenController {

    @Autowired
    public EduStudentEnrollKindergartenIntegration eduStudentEnrollKindergartenIntegration;

    @Operation(summary = "幼儿园报名管理分页查询",description = "幼儿园报名管理分页查询")
    @PostMapping(value = "/kindergarten0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduStudentEnrollKindergartenVO>> getList(@RequestBody @Validated EduStudentEnrollKindergartenQueryVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.getList(vo));
    }

    @Operation(summary = "幼儿园报名管理根据主键查询详情",description = "幼儿园报名管理根据主键查询详情")
    @PostMapping(value = "/kindergarten0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduStudentEnrollKindergartenVO> getById(@RequestBody @Validated EduStudentEnrollKindergartenKeyVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理报名新增",description = "幼儿园报名管理报名新增")
    @PostMapping(value = "/kindergarten0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduStudentEnrollKindergartenVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduStudentEnrollKindergartenVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.add(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园家长端报名",description = "幼儿园家长端报名")
    @PostMapping(value = "/kindergarten0015", produces = "application/json;charset=UTF-8")
    public AppResponse<EduStudentEnrollKindergartenVO> addApp(@RequestBody @Validated(value = {Validators.Add.class}) EduStudentEnrollKindergartenVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.addApp(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理端学校报名录入",description = "幼儿园报名管理端学校报名录入")
    @PostMapping(value = "/kindergarten0017", produces = "application/json;charset=UTF-8")
    public AppResponse<EduStudentEnrollKindergartenVO> addBySchool(@RequestBody @Validated(value = {Validators.Add.class}) EduStudentEnrollKindergartenVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.addBySchool(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理基础信息修改",description = "幼儿园报名管理基础信息修改")
    @PostMapping(value = "/kindergarten0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduStudentEnrollKindergartenVO> editBase(@RequestBody @Validated(value = {Validators.Edit.class}) EduStudentEnrollKindergartenVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.editBase(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理删除",description = "幼儿园报名管理删除")
    @PostMapping(value = "/kindergarten0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduStudentEnrollKindergartenKeyVO vo) {
        eduStudentEnrollKindergartenIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理退回报名",description = "幼儿园报名管理退回报名")
    @PostMapping(value = "/kindergarten0007", produces = "application/json;charset=UTF-8")
    public AppResponse nurseryFormBack(@RequestBody @Validated EduStudentEnrollKindergartenKeyVO  vo) {
        eduStudentEnrollKindergartenIntegration.nurseryFormBack(vo);
        return AppResponse.successMsg("删除成功！");
    }
    @Operation(summary = "幼儿园报名管理分页查询",description = "幼儿园报名管理分页查询")
    @PostMapping(value = "/kindergarten0008", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduStudentEnrollKindergartenVO>> getNurseryFormInfoByIdcard(@RequestBody @Validated KindergartenIdcardQueryVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.getNurseryFormInfoByIdcard(vo));
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理一键到待审核",description = "幼儿园报名管理一键到待审核")
    @PostMapping(value = "/kindergarten0009", produces = "application/json;charset=UTF-8")
    public AppResponse nurseryBackAuth(@RequestBody @Validated EduStudentEnrollKindergartenKeyVO  vo) {
        eduStudentEnrollKindergartenIntegration.nurseryBackAuth(vo);
        return AppResponse.successMsg("操作成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理设置报名无效",description = "幼儿园报名管理设置报名无效")
    @PostMapping(value = "/kindergarten0010", produces = "application/json;charset=UTF-8")
    public AppResponse nurserySetStatus(@RequestBody @Validated EduStudentEnrollKindergartenKeyVO  vo) {
        eduStudentEnrollKindergartenIntegration.nurserySetStatus(vo);
        return AppResponse.successMsg("操作成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理审核",description = "幼儿园报名管理审核")
    @PostMapping(value = "/kindergarten0011", produces = "application/json;charset=UTF-8")
    public AppResponse auth(@RequestBody @Validated EduStudentEnrollKindergartenAuthVO vo) {
        eduStudentEnrollKindergartenIntegration.auth(vo);
        return AppResponse.successMsg("操作成功！");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理单个录取",description = "幼儿园报名管理单个录取")
    @PostMapping(value = "/kindergarten0012", produces = "application/json;charset=UTF-8")
    public AppResponse auth(@RequestBody @Validated EduStudentEnrollKindergartenAdmitVO vo) {
        eduStudentEnrollKindergartenIntegration.admit(vo);
        return AppResponse.successMsg("操作成功！");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理一键录取",description = "幼儿园报名管理一键录取")
    @PostMapping(value = "/kindergarten0013", produces = "application/json;charset=UTF-8")
    public AppResponse admitBatch(@RequestBody @Validated EduStudentEnrollKindergartenAdmitVO vo) {
        eduStudentEnrollKindergartenIntegration.admitBatch(vo);
        return AppResponse.successMsg("操作成功！");
    }
    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理退回人员重新补录",description = "幼儿园报名管理退回人员重新补录")
    @PostMapping(value = "/kindergarten0014", produces = "application/json;charset=UTF-8")
    public AppResponse backDel(@RequestBody @Validated EduStudentEnrollKindergartenVO vo) {
        eduStudentEnrollKindergartenIntegration.backDel(vo);
        return AppResponse.successMsg("操作成功！");
    }
    @Idempotent(expire="PT10S") //2秒内防重复提交
    @Operation(summary = "幼儿园报名管理excel导出",description = "幼儿园报名管理excel导出")
    @PostMapping(value = "/kindergarten0016", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public void downloadData(@RequestBody @Validated EduStudentEnrollKindergartenQueryVO vo, HttpServletResponse response) {
        eduStudentEnrollKindergartenIntegration.downloadData(vo,response);
    }


    @Operation(summary = "幼儿园房产比对查询",description = "幼儿园房产比对查询")
    @PostMapping(value = "/kindergarten0018", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<KindergartenCompareVO>> getNurseryHouseCompareData(@RequestBody @Validated KindergartenCompareVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.getNurseryHouseCompareData(vo));
    }

    @Operation(summary = "幼儿园户籍比对查询",description = "幼儿园户籍比对查询")
    @PostMapping(value = "/kindergarten0019", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<KindergartenCompareVO>> getNurseryHouseHoldCompareData(@RequestBody @Validated KindergartenCompareVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.getNurseryHouseHoldCompareData(vo));
    }

    @PostMapping(value = "/kindergarten0020", produces = "application/json;charset=UTF-8")
    @Operation(summary = "幼儿园房产户籍比对",description = "幼儿园房产户籍比对")
    public AppResponse createBatch(@RequestBody @Validated KindergartenCompareVO vo) {
        eduStudentEnrollKindergartenIntegration.nurseryDataCompare(vo);
        return AppResponse.success();
    }

    @Operation(summary = "幼儿园房产和户籍比对查询",description = "幼儿园房产和户籍比对查询")
    @PostMapping(value = "/kindergarten0021", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<KindergartenCompareVO>> getNurseryHouseAndHouseHoldCompareData(@RequestBody @Validated KindergartenCompareVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.getNurseryHouseAndHouseHoldCompareData(vo));
    }

    @Operation(summary = "幼儿园校验是否可以绑定", description = "幼儿园校验是否可以绑定")
    @PostMapping(value = "/kindergarten0027", produces = "application/json;charset=UTF-8")
    public AppResponse<List<BindEnrollVO>> checkBind(@RequestBody @Validated BindEnrollQueryVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.checkBind(vo));
    }

    @Operation(summary = "幼儿园报名人数信息查询",description = "幼儿园报名人数信息查询")
    @PostMapping(value = "/kindergarten0022", produces = "application/json;charset=UTF-8")
    public AppResponse<StudentEnrollCntVO> queryKindergartenBmCnt(@RequestBody @Validated EduStudentEnrollKindergartenQueryVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.queryKindergartenBmCnt(vo));
    }


    @Operation(summary = "幼儿园摇号数据查询",description = "幼儿园摇号数据查询")
    @PostMapping(value = "/kindergarten0023", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduStudentEnrollKindergartenVO>> getKindergartenEnrollLottery(@RequestBody @Validated EduStudentEnrollKindergartenQueryVO vo) {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.getKindergartenEnrollLottery(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园摇号数据导出",description = "幼儿园摇号数据导出")
    @PostMapping(value = "/kindergarten0024", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public void exportKindergartenEnrollLottery(@RequestBody @Validated EduStudentEnrollKindergartenQueryVO vo, HttpServletResponse response) {
        eduStudentEnrollKindergartenIntegration.exportKindergartenEnrollLottery(vo,response);
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园摇号数据导入",description = "幼儿园摇号数据导入")
    @PostMapping(value = "/kindergarten0025", produces = "application/json;charset=UTF-8")
    @NoSignCrypto
    public AppResponse<KindergartenApplyFileVO> inputKindergartenApplyInfo(
            KindergartenApplyFileVO vo, @RequestParam("file") MultipartFile file) throws IOException {
        return AppResponse.successData(eduStudentEnrollKindergartenIntegration.inputKindergartenApplyInfo(vo, file));
    }

    @PostMapping(value = "/kindergarten0026", produces = "application/json;charset=UTF-8")
    @Operation(summary = "幼儿园校验是否可以摇号导出",description = "幼儿园校验是否可以摇号导出")
    public AppResponse checkYhExp(@RequestBody EduStudentEnrollKindergartenQueryVO vo) {
        eduStudentEnrollKindergartenIntegration.checkKindergartenExp(vo);
        return AppResponse.success();
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园单个清除缓存",description = "幼儿园单个清除缓存")
    @PostMapping(value = "/kindergarten0028", produces = "application/json;charset=UTF-8")
    public AppResponse clearnurseryhc(@RequestBody @Validated EduStudentEnrollKindergartenQueryVO  vo) {
        eduStudentEnrollKindergartenIntegration.clearnurseryhc(vo);
        return AppResponse.successMsg("操作成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "幼儿园批量清除缓存",description = "幼儿园批量清除缓存")
    @PostMapping(value = "/kindergarten0029", produces = "application/json;charset=UTF-8")
    public AppResponse clearNurseryQueryCache(@RequestBody @Validated EduStudentEnrollKindergartenQueryVO  vo) {
        eduStudentEnrollKindergartenIntegration.clearNurseryQueryCache(vo);
        return AppResponse.successMsg("操作成功！");
    }
}
